Compares a list of DocumentPageText objects
public IList<TextDifference> CompareText(
IList<DocumentPageText> pages
)
pages
List of DocumentPageText objects to compare.
A list of TextDifferences.
Exactly two DocumentPageText objects must be provided.
This method will compare the DocumentPageText objects and return just the TextDifferences. If you are interested in the positional information for the differences, use the CompareDocumentPage method instead.
using Leadtools.Document;
using Leadtools.Document.Compare;
using Leadtools;
public void CompareTextDocumentPageTextExample()
{
var doc1 = DocumentFactory.LoadFromFile(pathToDocument1, new LoadDocumentOptions());
var doc2 = DocumentFactory.LoadFromFile(pathToDocument2, new LoadDocumentOptions());
var textList = new List<DocumentPageText>()
{
doc1.Pages.First().GetText(),
doc2.Pages.First().GetText()
};
var comparer = new DocumentComparer();
var diffs = comparer.CompareText(textList);
foreach (TextDifference diff in diffs)
{
Console.WriteLine($"Operations: {diff.Operation}");
Console.WriteLine($"Text: {diff.Text}");
Console.WriteLine("--------");
}
}